package com.changgou.goods.dao;

import com.changgou.goods.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandMapper extends Mapper<Brand> {

    /**
     *
     * @param cateName
     * @return
     * 根据分类名称查询品牌列表
     */
    @Select("SELECT a.* FROM tb_brand a JOIN tb_category_brand b ON a.id = b.brand_id JOIN tb_category c " +
            "ON c.id = b.category_id WHERE c.name=#{name}")
    //@Param("name") 作用：使参数名称对应
    List<Brand> findBrandByCateName(@Param("name") String cateName);
}
